function cfdScreenOutputPhy(timeIrt)
%--------------------------------------------------------------------------
%  Written by LiuHaHa @ NWPU, 2022 01 
%  Contact me at: liuzhikan@mail.nwpu.edu.cn
%==========================================================================
% Routine Description:
%   This function prints residuals to console
%--------------------------------------------------------------------------
global cfdFlow slvpara;
phyTemp = cfdFlow.Phy;
phyPreOutput = cfdFlow.phyPreOutput;
theNumberOfElements = cfdFlow.mesh.numberOfElements;

%  only for the energy equation
resd = abs(dot((phyTemp(1:theNumberOfElements,end) - phyPreOutput(1:theNumberOfElements,end)), ... 
           (phyTemp(1:theNumberOfElements,end) - phyPreOutput(1:theNumberOfElements,end))));

[maxResd, eleLabel] = max(abs(phyTemp(1:theNumberOfElements,end) - phyPreOutput(1:theNumberOfElements,end)));       
       
       
sumResd = sum(resd);       
L2meanResd = sqrt(sumResd/theNumberOfElements);
if (timeIrt == 1)          
    fprintf('|--------------------------------------------------------------------------|\n');
    fprintf('|  Irt  |         L2_rsd          |          Max_rsd       |      EleLabel |\n');
    fprintf('|--------------------------------------------------------------------------|\n');
end
if (mod(timeIrt,10) == 0)
    fprintf('|--------------------------------------------------------------------------|\n');
    fprintf('|  Irt  |         L2_rsd          |          Max_rsd       |      EleLabel |\n');
    fprintf('|--------------------------------------------------------------------------|\n');
    if (slvpara.flx_order == 1)
        fprintf('                        The 1st order calculation                         \n');
    else
        fprintf('                        The 2nd order calculation                         \n');
    end
end
fprintf('|  %d    |      %12.8f       |      %12.8f      |         %d     |\n',timeIrt,L2meanResd,maxResd,eleLabel);   
if(isnan(L2meanResd) || isnan(maxResd))      
    error('Error:  Wan Dan Le :  NaN  NaN  \n');
end
 cfdFlow.phyPreOutput = cfdFlow.Phy;      
       
       
       